home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / cw15 / tpw15.z / EXTENS.TPW < prev    next >
Text File  |  1995-08-17  |  9KB  |  245 lines

  1. #!----------------------------------------------------------------
  2. #EXTENSION(RecordValidation,'Validate a record against the dictionary'),HLP('~TPLExtensionRecordValidation'),PROCEDURE
  3. #BOXED('Record Validation')
  4.   #DISPLAY('Control Value Validation Conditions..')
  5.   #PROMPT('Validate when the control is Accepted',CHECK),%ValidateOnAccept,AT(10,,150),DEFAULT(1)
  6.   #PROMPT('Validate during Non-Stop Select',CHECK),%ValidateOnNonStopSelect,DEFAULT(1),AT(10,,150)
  7.   #BUTTON('Do Not Validate...'),MULTI(%ControlsExcluded,%ControlToExclude),AT(10,,180),HLP('~TPLExtensionRecordValidation')
  8.     #PROMPT('Control to Exclude',CONTROL),%ControlToExclude
  9.   #ENDBUTTON
  10. #ENDBOXED
  11. #AT(%GatherSymbols)
  12.   #FOR(%Control)                               #! FOR each screen field
  13.     #FIND(%Field,%ControlUse)                  #! FIX to process field
  14.     #IF(%Field)
  15.       #IF(%FieldLookup)                        #! IF Must Be In File
  16.         #ADD(%ProcFilesUsed,%FieldLookup)      #! FIX for file processing
  17.       #ENDIF                                   #! END (IF Must Be In File)
  18.     #ENDIF
  19.   #ENDFOR                                      #! END (FOR each screen field)
  20. #ENDAT
  21. #AT(%ControlPostEventHandling)
  22.   #SUSPEND
  23.     #IF(%ControlEvent = 'Accepted')
  24.       #IF(%ValidateOnAccept OR %ValidateOnNonStopSelect)
  25.         #IF(%ValidateOnAccept AND %validateOnNonStopSelect)
  26. #INSERT(%RecordValidationCode)
  27.         #ELSIF(%ValidateOnAccept)
  28. #?IF %Window{Prop:AcceptAll} = False
  29.   #INSERT(%RecordValidationCode)
  30. #?END
  31.         #ELSE
  32. #?IF %Window{Prop:AcceptAll} = True
  33.   #INSERT(%RecordValidationCode)
  34. #?END
  35.         #ENDIF
  36.       #ENDIF
  37.     #ENDIF
  38.   #RESUME
  39. #ENDAT
  40. #!----------------------------------------------------------------
  41. #GROUP(%RecordValidationCode)
  42.   #FIND(%ControlToExclude,%Control)
  43.   #IF(NOT %ControlToExclude)
  44.     #CASE(%ControlType)
  45.     #OF('ENTRY')
  46.     #OROF('SPIN')
  47.     #OROF('DROP')
  48.     #OROF('COMBO')
  49.       #FIND(%Field,%ControlUse)
  50.       #IF(%FieldLookup)
  51.         #FIX(%File,%FieldFile)
  52.         #FIX(%Relation,%FieldLookup)
  53.         #FOR(%FileKeyField)
  54. %FileKeyFieldLink = %FileKeyField
  55.         #ENDFOR
  56. GET(%Relation,%RelationKey)
  57. IF ERRORCODE()
  58.         #IF(%FieldDescription)
  59.   IF StandardWarning(Warn:NotInFile,'%'FieldDescription','%Relation')
  60.         #ELSE
  61.   IF StandardWarning(Warn:NotInFile,'%Field','%Relation')
  62.         #ENDIF
  63.     SELECT(%Control)
  64.         #IF(%ValidateOnNonStopSelect)
  65.     %Window{Prop:AcceptAll} = False
  66.         #ENDIF
  67.     CYCLE
  68.   END
  69. END
  70.       #ENDIF
  71.       #IF(%FieldRangeLow OR %FieldRangeHigh)
  72.         #IF(%FieldDescription)
  73.           #IF(%FieldRangeLow AND %FieldRangeHigh)
  74. IF NOT INRANGE(%Field,%FieldRangeLow,%FieldRangeHigh)
  75.   IF StandardWarning(Warn:OutOfRange,'%'FieldDescription','%FieldRangeLow','%FieldRangeHigh')
  76.           #ELSIF(%FieldRangeLow)
  77. IF %Field < %FieldRangeLow
  78.   IF StandardWarning(Warn:OutOfRangeLow,'%'FieldDescription','%FieldRangeLow')
  79.           #ELSE
  80. IF %Field > %FieldRangeHigh
  81.   IF StandardWarning(Warn:OutOfRangeHigh,'%'FieldDescription','%FieldRangeHigh')
  82.           #ENDIF
  83.         #ELSE
  84.           #IF(%FieldRangeLow AND %FieldRangeHigh)
  85. IF NOT INRANGE(%Field,%FieldRangeLow,%FieldRangeHigh)
  86.   IF StandardWarning(Warn:OutOfRange,'%Field','%FieldRangeLow','%FieldRangeHigh')
  87.           #ELSIF(%FieldRangeLow)
  88. IF %Field < %FieldRangeLow
  89.   IF StandardWarning(Warn:OutOfRangeLow,'%Field','%FieldRangeLow')
  90.           #ELSE
  91. IF %Field > %FieldRangeHigh
  92.   IF StandardWarning(Warn:OutOfRangeHigh,'%Field','%FieldRangeHigh')
  93.           #ENDIF
  94.         #ENDIF
  95.     SELECT(%Control)
  96.         #IF(%ValidateOnNonStopSelect)
  97.     %Window{Prop:AcceptAll} = False
  98.         #ENDIF
  99.     CYCLE
  100.   END
  101. END
  102.       #ENDIF
  103.     #ENDCASE
  104.   #ENDIF
  105. #!----------------------------------------------------------------
  106. #EXTENSION(DateTimeDisplay,'Display the date and/or time in the current window'),HLP('~TPLExtensionDateTimeDisplay'),PROCEDURE,LAST
  107. #BUTTON('Date and Time Display'),AT(10,,180),HLP('~TPLExtensionDateTimeDisplay')
  108.   #BOXED('Date Display...')
  109.     #PROMPT('Display the current day/date in the window',CHECK),%DisplayDate,DEFAULT(0),AT(10,,150)
  110.     #ENABLE(%DisplayDate)           
  111.       #PROMPT('Date Picture:',DROP('October 31, 1959|OCT 31,1959|10/31/59|10/31/1959|31 OCT 59|31 OCT 1959|31/10/59|31/10/1959|Other')),%DatePicture,DEFAULT('October 31, 1959')
  112.       #ENABLE(%DatePicture = 'Other')
  113.         #PROMPT('Other Date Picture:',@S20),%OtherDatePicture,REQ
  114.       #ENDENABLE
  115.       #PROMPT('Show the day of the week before the date',CHECK),%ShowDayOfWeek,DEFAULT(1),AT(10,,150)
  116.       #PROMPT('&Location of Date Display:',DROP('Control|Status Bar')),%DateDisplayLocation
  117.       #ENABLE(%DateDisplayLocation='Status Bar')
  118.         #PROMPT('Status Bar Section:',@n1),%DateStatusSection,REQ,DEFAULT(1)
  119.       #ENDENABLE
  120.       #ENABLE(%DateDisplayLocation='Control')
  121.         #PROMPT('Date Display Control:',CONTROL),%DateControl,REQ
  122.       #ENDENABLE
  123.     #ENDENABLE
  124.   #ENDBOXED
  125.   #BOXED('Time Display...')
  126.     #PROMPT('Display the current time in the window',CHECK),%DisplayTime,DEFAULT(0),AT(10,,150)
  127.     #ENABLE(%DisplayTime)           
  128.       #PROMPT('Time Picture:',DROP('5:30PM|5:30:00PM|17:30|17:30:00|1730|173000|Other')),%TimePicture,DEFAULT('5:30PM')
  129.       #ENABLE(%TimePicture = 'Other')
  130.         #PROMPT('Other Time Picture:',@S20),%OtherTimePicture,REQ
  131.       #ENDENABLE
  132.       #PROMPT('&Location of Time Display:',DROP('Control|Status Bar')),%TimeDisplayLocation
  133.       #ENABLE(%TimeDisplayLocation='Status Bar')
  134.         #PROMPT('Status Bar Section:',@n1),%TimeStatusSection,REQ,DEFAULT(2)
  135.       #ENDENABLE
  136.       #ENABLE(%TimeDisplayLocation='Control')
  137.         #PROMPT('Time Display Control:',CONTROL),%TimeControl,REQ
  138.       #ENDENABLE
  139.     #ENDENABLE
  140.   #ENDBOXED
  141. #ENDBUTTON
  142. #ATSTART
  143.   #DECLARE(%TimerEventGenerated)
  144.   #IF(%DisplayDate)
  145.     #DECLARE(%DateUsePicture)
  146.     #CASE(%DatePicture)
  147.     #OF('10/31/59')
  148.       #SET(%DateUsePicture,'@D1')
  149.     #OF('10/31/1959')
  150.       #SET(%DateUsePicture,'@D2')
  151.     #OF('OCT 31,1959')
  152.       #SET(%DateUsePicture,'@D3')
  153.     #OF('October 31, 1959')
  154.       #SET(%DateUsePicture,'@D4')
  155.     #OF('31/10/59')
  156.       #SET(%DateUsePicture,'@D5')
  157.     #OF('31/10/1959')
  158.       #SET(%DateUsePicture,'@D6')
  159.     #OF('31 OCT 59')
  160.       #SET(%DateUsePicture,'@D7')
  161.     #OF('31 OCT 1959')
  162.       #SET(%DateUsePicture,'@D8')
  163.     #OF('Other')
  164.       #SET(%DateUsePicture,%OtherDatePicture)
  165.     #ENDCASE
  166.   #ENDIF
  167.   #IF(%DisplayTime)
  168.     #DECLARE(%TimeUsePicture)
  169.     #CASE(%TimePicture)
  170.     #OF('17:30')
  171.       #SET(%TimeUsePicture,'@T1')
  172.     #OF('1730')
  173.       #SET(%TimeUsePicture,'@T2')
  174.     #OF('5:30PM')
  175.       #SET(%TimeUsePicture,'@T3')
  176.     #OF('17:30:00')
  177.       #SET(%TimeUsePicture,'@T4')
  178.     #OF('173000')
  179.       #SET(%TimeUsePicture,'@T5')
  180.     #OF('5:30:00PM')
  181.       #SET(%TimeUsePicture,'@T6')
  182.     #OF('Other')
  183.       #SET(%TimeUsePicture,%OtherTimePicture)
  184.     #ENDCASE
  185.   #ENDIF
  186. #ENDAT
  187. #AT(%DataSectionBeforeWindow)
  188.   #IF(%DisplayDate AND %ShowDayOfWeek)
  189. DisplayDayString STRING('Sunday   Monday   Tuesday  WednesdayThursday Friday   Saturday ')
  190. DisplayDayText   STRING(9),DIM(7),OVER(DisplayDayString)
  191.   #ENDIF
  192. #ENDAT
  193. #AT(%BeforeAccept)
  194.   #IF(%DisplayTime OR %DisplayDate)
  195. IF NOT INRANGE(%Window{Prop:Timer},1,100)
  196.   %Window{Prop:Timer} = 100
  197. END
  198. #INSERT(%DateTimeDisplayCode)
  199.   #ENDIF
  200. #ENDAT
  201. #AT(%WindowEventHandling,'Timer')
  202.   #SET(%TimerEventGenerated,%True)
  203.   #IF(%DisplayDate OR %DisplayTime)
  204. #INSERT(%DateTimeDisplayCode)
  205.   #ENDIF
  206. #ENDAT
  207. #AT(%WindowOtherEventHandling)
  208.   #IF(%DisplayDate OR %DisplayTime)
  209.     #IF(NOT %TimerEventGenerated)
  210. IF EVENT() = Event:Timer
  211.   #INSERT(%DateTimeDisplayCode)
  212. END
  213.     #ENDIF
  214.   #ENDIF
  215. #ENDAT
  216. #GROUP(%DateTimeDisplayCode)
  217.   #IF(%DisplayDate)
  218.     #IF(%ShowDayOfWeek)
  219.       #CASE(%DateDisplayLocation)
  220.       #OF('Control')
  221.   %DateControl{Prop:Text} = CLIP(DisplayDayText[(TODAY()%%7)+1]) & ', ' & FORMAT(TODAY(),%DateUsePicture)
  222.   DISPLAY(%DateControl)
  223.       #ELSE
  224.   %Window{Prop:StatusText,%DateStatusSection} = CLIP(DisplayDayText[(TODAY()%%7)+1]) & ', ' & FORMAT(TODAY(),%DateUsePicture)
  225.       #ENDCASE
  226.     #ELSE
  227.       #CASE(%DateDisplayLocation)
  228.       #OF('Control')
  229.   %DateControl{Prop:Text} = FORMAT(TODAY(),%DateUsePicture)
  230.   DISPLAY(%DateControl)
  231.       #ELSE
  232.   %Window{Prop:StatusText,%DateStatusSection} = FORMAT(TODAY(),%DateUsePicture)
  233.       #ENDCASE
  234.     #ENDIF
  235.   #ENDIF
  236.   #IF(%DisplayTime)
  237.     #CASE(%TimeDisplayLocation)
  238.     #OF('Control')
  239.   %TimeControl{Prop:Text} = FORMAT(CLOCK(),%TimeUsePicture)
  240.   DISPLAY(%TimeControl)
  241.     #ELSE
  242.   %Window{Prop:StatusText,%TimeStatusSection} = FORMAT(CLOCK(),%TimeUsePicture)
  243.     #ENDCASE
  244.   #ENDIF
  245.